<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>提醒功能</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/提醒功能.css">
    <link rel="stylesheet" href="js/M_select/M_select.css">
    <link rel="stylesheet" href="laydate/theme/default/laydate.css">
    <link rel="stylesheet" href="layui/css/layui.css">
</head>

<body>
    <div id="allbox">
        <h2>提醒功能</h2>
        <div id="box">
            <div id="addwarn">
                <form action="" class="layui-form">
                    <span>模块</span>
                    <div style="display:inline-block;width: 150px;">
                        <select class="select01" id="slc02">
                            <option value="模块" disabled selected hidden>模块</option>
                            <option value="2">学生管理</option>
                            <option value="1">院校管理</option>
                        </select>
                    </div>
                    <span>提醒人</span>
                    <div style="display:inline-block;width: 150px;">
                        <select class="select01" id="slc01">
                            <option value="员工姓名" disabled selected hidden>员工姓名</option>
                            <!-- <option value="1">乔碧萝</option>
                            <option value="2">李时珍</option>
                            <option value="3">张三</option>
                            <option value="4">李四</option> -->
                        </select>
                    </div>
                    <span>提醒事项</span>
                    <div style="display:inline-block;width: 150px;">
                        <select class="select01" id="slc03">
                            <option value="提醒事项" disabled selected hidden>提醒事项</option>
                            <option value="1">待跟进量提醒</option>
                            <option value="2">转公共量提醒</option>
                            <option value="3">接收量提醒</option>
                        </select>
                    </div>
                    <span>提醒内容</span>
                    <input type="text" placeholder="请输入提醒内容" id="warnmain">
                    <div>
                        <span>提醒时间</span>
                        <input type="text" id="test1" placeholder="选择日期">
                        <em>--</em>
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="test2" placeholder="选择时间">
                            </div>
                        </div>
                    </div>
                    <input type="button" value="添加提醒" id="tixi">
                </form>
            </div>
            <div id="tab">
                <div id="hid">
                    <table border="1" id="myTable" class="tablesorter">
                        <thead>
                            <tr>
                                <th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
                                <th>提醒人</th>
                                <th>模块</th>
                                <th>提醒事项</th>
                                <th>提醒内容</th>
                                <th id="paiXu">提醒时间<i id="up"></i><i id="down"></i></th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <!-- <tr>
                                <td>1</td>
                                <td>陆小凤</td>
                                <td>学生管理</td>
                                <td>转公共量提醒</td>
                                <td>需要转至公共量中</td>
                                <td>2020-12-31 15:53:30</td>
                                <td>
                                    <span class="sp1"><span></span></span>
                                    <span class="sp2"></span>
                                </td>
                            </tr> -->
                        </tbody>
                    </table>
                </div>
                <div id="page"></div>
            </div>
        </div>
    </div>
</body>

</html>
<script src="js/jquery-3.4.1.js"></script>
<script src="js/M_select/M_select.js"></script>
<script src="laydate/laydate.js"></script>
<script src="js/xlPaging.js"></script>
<script src="layui/layui.js"></script>
<script>
    var remindBtn = 'http://192.168.3.21:9999/oaSystem/remind';
    var tabUrl = 'http://192.168.3.21:9999/oaSystem/remind';
    // 设置日历插件
    //执行一个laydate实例
    laydate.render({
        elem: '#test1' //指定元素
    });
    // 设置时间插件
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#test2'
            , type: 'time'
        })
    });
    // 设置提醒时间的排序功能
    // 点击下三角排序
    $("#down").click(function () {
        $.ajax({
            url: remindBtn,
            type: 'get',
            dataType: 'json',
            data: {
                // empId: '10001',
                currentPage: '1',
                asc: '1',
                rows: '10',
                method: 'remindAll',
            },
            success: function (data) {
                console.log(data);
                if (data.code == 100) {
                    // 清空table数据
                    $(".trm").remove();
                    // 添加数据
                    for (var i = 0; i < data.result.list.length; i++) {
                        // 创建tr添加到table中
                        var trM = $('<tr>').appendTo('tbody');
                        $(trM).prop("class", "trm");
                        //创建td添加到tr中
                        $('<td>').html(i + 1).appendTo(trM);
                        $('<td>').html(data.result.list[i].empName).appendTo(trM);
                        if (data.result.list[i].moduleId == 1) {
                            data.result.list[i].moduleId = '院校管理';
                        } else {
                            data.result.list[i].moduleId = '学生管理';
                        }
                        $('<td>').html(data.result.list[i].moduleId).appendTo(trM);
                        if (data.result.list[i].remindTypeId == 1) {
                            data.result.list[i].remindTypeId = '待跟进量提醒';
                        } else if (data.result.list[i].remindTypeId == 2) {
                            data.result.list[i].remindTypeId = '转公共量提醒';
                        } else {
                            data.result.list[i].remindTypeId = '接收量提醒';
                        }
                        $('<td>').html(data.result.list[i].remindTypeId).appendTo(trM);
                        $('<td>').html(data.result.list[i].remindContent).appendTo(trM);
                        var oremindTime = parseInt(data.result.list[i].remindTime);
                        var newData = new Date(oremindTime);
                        var iYear = newData.getFullYear();
                        var iMonth = newData.getMonth();
                        var iDay = newData.getDate();
                        var iHour = newData.getHours();
                        var iMinutes = newData.getMinutes();
                        var iSecond = newData.getMilliseconds();
                        var iTime = iYear + '-' + iMonth + '-' + iDay + ' ' + iHour + ':' + iMinutes + ':' + iSecond;
                        $('<td>').html(iTime).appendTo(trM);
                        $("<td><span class='sp1' onoff = " + data.result.list[i].remindState + " clicId = " + data.result.list[i].remindId + "><span></span></span><span class='sp2' clicId = " + data.result.list[i].remindId + "></span></td>").appendTo(trM);
                        // 设置开关
                        // console.log($(".sp1:eq(" + i + ")").attr('onoff'));
                        // console.log($(".sp1:eq(" + i + ")").attr('clicId'));
                        if ($(".sp1:eq(" + i + ")").attr('onoff') == 1) {
                            $(".sp1:eq(" + i + ")").css('background', '#13ce66');
                            $(".sp1:eq(" + i + ")").children('span').animate({
                                left: '20px'
                            }, 200);
                        } else {
                            $(".sp1:eq(" + i + ")").css('background', '#ff4949');
                            $(".sp1:eq(" + i + ")").children('span').animate({
                                left: '0px'
                            }, 200);
                        }
                    };
                    //设置开关属性 
                    $('table').find('.sp1').each(function (i, v) {
                        this.onoff = $(".sp1:eq(" + i + ")").attr("onoff");
                        this.clicId = $(".sp1:eq(" + i + ")").attr("clicId");
                        // console.log(this.onoff)
                    });
                    // 设置删除按钮属性
                    $('table').find('.sp2').each(function (i, v) {
                        this.clicId = $(".sp2:eq(" + i + ")").attr("clicId");
                        // console.log(this.clicId);
                    });
                } else {
                    alert('没有数据了');
                }
            },
            error: function (xhr, errorInfo) {
                console.log('降序排序功能ajax请求失败');
            }
        });
        $("#down").css('background', "url('img/下绿三角.png') center center no-repeat");
        $("#down").css('background-size', "100%");
        $("#up").css('background', "url('img/上灰三角.png') center center no-repeat");
        $("#up").css('background-size', "100%");
    });
    // 点击上三角排序
    $("#up").click(function () {
        $.ajax({
            url: remindBtn,
            type: 'get',
            dataType: 'json',
            data: {
                // empId: '10001',
                currentPage: '1',
                asc: '2',
                rows: '10',
                method: 'remindAll',
            },
            success: function (data) {
                console.log(data);
                if (data.code == 100) {
                    // 清空table数据
                    $(".trm").remove();
                    // 添加数据
                    for (var i = 0; i < data.result.list.length; i++) {
                        // 创建tr添加到table中
                        var trM = $('<tr>').appendTo('tbody');
                        $(trM).prop("class", "trm");
                        //创建td添加到tr中
                        $('<td>').html(i + 1).appendTo(trM);
                        $('<td>').html(data.result.list[i].empName).appendTo(trM);
                        if (data.result.list[i].moduleId == 1) {
                            data.result.list[i].moduleId = '院校管理';
                        } else {
                            data.result.list[i].moduleId = '学生管理';
                        }
                        $('<td>').html(data.result.list[i].moduleId).appendTo(trM);
                        if (data.result.list[i].remindTypeId == 1) {
                            data.result.list[i].remindTypeId = '待跟进量提醒';
                        } else if (data.result.list[i].remindTypeId == 2) {
                            data.result.list[i].remindTypeId = '转公共量提醒';
                        } else {
                            data.result.list[i].remindTypeId = '接收量提醒';
                        }
                        $('<td>').html(data.result.list[i].remindTypeId).appendTo(trM);
                        $('<td>').html(data.result.list[i].remindContent).appendTo(trM);
                        var oremindTime = parseInt(data.result.list[i].remindTime);
                        var newData = new Date(oremindTime);
                        var iYear = newData.getFullYear();
                        var iMonth = newData.getMonth();
                        var iDay = newData.getDate();
                        var iHour = newData.getHours();
                        var iMinutes = newData.getMinutes();
                        var iSecond = newData.getMilliseconds();
                        var iTime = iYear + '-' + iMonth + '-' + iDay + ' ' + iHour + ':' + iMinutes + ':' + iSecond;
                        $('<td>').html(iTime).appendTo(trM);
                        $("<td><span class='sp1' onoff = " + data.result.list[i].remindState + " clicId = " + data.result.list[i].remindId + "><span></span></span><span class='sp2' clicId = " + data.result.list[i].remindId + "></span></td>").appendTo(trM);
                        // 设置开关
                        // console.log($(".sp1:eq(" + i + ")").attr('onoff'));
                        // console.log($(".sp1:eq(" + i + ")").attr('clicId'));
                        if ($(".sp1:eq(" + i + ")").attr('onoff') == 1) {
                            $(".sp1:eq(" + i + ")").css('background', '#13ce66');
                            $(".sp1:eq(" + i + ")").children('span').animate({
                                left: '20px'
                            }, 200);
                        } else {
                            $(".sp1:eq(" + i + ")").css('background', '#ff4949');
                            $(".sp1:eq(" + i + ")").children('span').animate({
                                left: '0px'
                            }, 200);
                        }
                    };
                    //设置开关属性 
                    $('table').find('.sp1').each(function (i, v) {
                        this.onoff = $(".sp1:eq(" + i + ")").attr("onoff");
                        this.clicId = $(".sp1:eq(" + i + ")").attr("clicId");
                        // console.log(this.onoff)
                    });
                    // 设置删除按钮属性
                    $('table').find('.sp2').each(function (i, v) {
                        this.clicId = $(".sp2:eq(" + i + ")").attr("clicId");
                        // console.log(this.clicId);
                    });
                } else {
                    alert('没有数据了');
                }
            },
            error: function (xhr, errorInfo) {
                console.log('升序排序功能ajax请求失败');
            }
        });
        $("#up").css('background', "url('img/上绿三角.png') center center no-repeat");
        $("#up").css('background-size', "100%");
        $("#down").css('background', "url('img/下灰三角.png') center center no-repeat");
        $("#down").css('background-size', "100%");
    });

    // 设置分页器
    // xlPaging.js 使用方法
    $("#page").paging({
        nowPage: 1, // 当前页码
        pageNum: 12, // 总页码
        buttonNum: 6, //要展示的页码数量
        canJump: 1,// 是否能跳转。0=不显示（默认），1=显示
        showOne: 1,//只有一页时，是否显示。0=不显示,1=显示（默认）
        callback: function (num) { //回调函数
            console.log(num);
            // ajax请求表格数据
            $(".trm").remove();
            $.ajax({
                url: tabUrl,
                type: 'get',
                dataType: 'json',
                data: {
                    empId: '10001',
                    currentPage: num,
                    rows: '10',
                    method: 'remindAll',
                    asc: '1',
                },
                success: function (data) {
                    if (data.code == 100) {
                        allPage = data.result.totalPage;

                        for (var i = 0; i < data.result.list.length; i++) {
                            // 创建tr添加到table中
                            var trM = $('<tr>').appendTo('tbody');
                            $(trM).prop("class", "trm");
                            //创建td添加到tr中
                            $('<td>').html(i + 1).appendTo(trM);
                            $('<td>').html(data.result.list[i].empName).appendTo(trM);
                            if (data.result.list[i].moduleId == 1) {
                                data.result.list[i].moduleId = '院校管理';
                            } else {
                                data.result.list[i].moduleId = '学生管理';
                            }
                            $('<td>').html(data.result.list[i].moduleId).appendTo(trM);
                            if (data.result.list[i].remindTypeId == 1) {
                                data.result.list[i].remindTypeId = '待跟进量提醒';
                            } else if (data.result.list[i].remindTypeId == 2) {
                                data.result.list[i].remindTypeId = '转公共量提醒';
                            } else {
                                data.result.list[i].remindTypeId = '接收量提醒';
                            }
                            $('<td>').html(data.result.list[i].remindTypeId).appendTo(trM);
                            $('<td>').html(data.result.list[i].remindContent).appendTo(trM);
                            var oremindTime = parseInt(data.result.list[i].remindTime);
                            var newData = new Date(oremindTime);
                            var iYear = newData.getFullYear();
                            var iMonth = newData.getMonth();
                            var iDay = newData.getDate();
                            var iHour = newData.getHours();
                            var iMinutes = newData.getMinutes();
                            var iSecond = newData.getMilliseconds();
                            var iTime = iYear + '-' + iMonth + '-' + iDay + ' ' + iHour + ':' + iMinutes + ':' + iSecond;
                            $('<td>').html(iTime).appendTo(trM);
                            $("<td><span class='sp1' onoff = " + data.result.list[i].remindState + " clicId = " + data.result.list[i].remindId + "><span></span></span><span class='sp2' clicId = " + data.result.list[i].remindId + "></span></td>").appendTo(trM);
                            // 设置开关
                            // console.log($(".sp1:eq(" + i + ")").attr('onoff'));
                            // console.log($(".sp1:eq(" + i + ")").attr('clicId'));
                            if ($(".sp1:eq(" + i + ")").attr('onoff') == 1) {
                                $(".sp1:eq(" + i + ")").css('background', '#13ce66');
                                $(".sp1:eq(" + i + ")").children('span').animate({
                                    left: '20px'
                                }, 200);
                            } else {
                                $(".sp1:eq(" + i + ")").css('background', '#ff4949');
                                $(".sp1:eq(" + i + ")").children('span').animate({
                                    left: '0px'
                                }, 200);
                            }
                        };
                        //设置开关属性 
                        $('table').find('.sp1').each(function (i, v) {
                            this.onoff = $(".sp1:eq(" + i + ")").attr("onoff");
                            this.clicId = $(".sp1:eq(" + i + ")").attr("clicId");
                            // console.log(this.onoff)
                        });
                        // 设置删除按钮属性
                        $('table').find('.sp2').each(function (i, v) {
                            this.clicId = $(".sp2:eq(" + i + ")").attr("clicId");
                            // console.log(this.clicId);
                        });
                    } else {
                        alert('没有数据了');
                    }
                },
                error: function (xhr, errorInfo) {
                    console.log('表格数据ajax请求失败');
                }
            });

            // 设置提醒时间的排序功能
            // 点击下三角排序
            $("#down").click(function () {
                $.ajax({
                    url: remindBtn,
                    type: 'get',
                    dataType: 'json',
                    data: {
                        // empId: '10001',
                        currentPage: num,
                        asc: '1',
                        rows: '10',
                        method: 'remindAll',
                    },
                    success: function (data) {
                        console.log(data);
                        if (data.code == 100) {
                            // 清空table数据
                            $(".trm").remove();
                            // 添加数据
                            for (var i = 0; i < data.result.list.length; i++) {
                                // 创建tr添加到table中
                                var trM = $('<tr>').appendTo('tbody');
                                $(trM).prop("class", "trm");
                                //创建td添加到tr中
                                $('<td>').html(i + 1).appendTo(trM);
                                $('<td>').html(data.result.list[i].empName).appendTo(trM);
                                if (data.result.list[i].moduleId == 1) {
                                    data.result.list[i].moduleId = '院校管理';
                                } else {
                                    data.result.list[i].moduleId = '学生管理';
                                }
                                $('<td>').html(data.result.list[i].moduleId).appendTo(trM);
                                if (data.result.list[i].remindTypeId == 1) {
                                    data.result.list[i].remindTypeId = '待跟进量提醒';
                                } else if (data.result.list[i].remindTypeId == 2) {
                                    data.result.list[i].remindTypeId = '转公共量提醒';
                                } else {
                                    data.result.list[i].remindTypeId = '接收量提醒';
                                }
                                $('<td>').html(data.result.list[i].remindTypeId).appendTo(trM);
                                $('<td>').html(data.result.list[i].remindContent).appendTo(trM);
                                var oremindTime = parseInt(data.result.list[i].remindTime);
                                var newData = new Date(oremindTime);
                                var iYear = newData.getFullYear();
                                var iMonth = newData.getMonth();
                                var iDay = newData.getDate();
                                var iHour = newData.getHours();
                                var iMinutes = newData.getMinutes();
                                var iSecond = newData.getMilliseconds();
                                var iTime = iYear + '-' + iMonth + '-' + iDay + ' ' + iHour + ':' + iMinutes + ':' + iSecond;
                                $('<td>').html(iTime).appendTo(trM);
                                $("<td><span class='sp1' onoff = " + data.result.list[i].remindState + " clicId = " + data.result.list[i].remindId + "><span></span></span><span class='sp2' clicId = " + data.result.list[i].remindId + "></span></td>").appendTo(trM);
                                // 设置开关
                                // console.log($(".sp1:eq(" + i + ")").attr('onoff'));
                                // console.log($(".sp1:eq(" + i + ")").attr('clicId'));
                                if ($(".sp1:eq(" + i + ")").attr('onoff') == 1) {
                                    $(".sp1:eq(" + i + ")").css('background', '#13ce66');
                                    $(".sp1:eq(" + i + ")").children('span').animate({
                                        left: '20px'
                                    }, 200);
                                } else {
                                    $(".sp1:eq(" + i + ")").css('background', '#ff4949');
                                    $(".sp1:eq(" + i + ")").children('span').animate({
                                        left: '0px'
                                    }, 200);
                                }
                            };
                            //设置开关属性 
                            $('table').find('.sp1').each(function (i, v) {
                                this.onoff = $(".sp1:eq(" + i + ")").attr("onoff");
                                this.clicId = $(".sp1:eq(" + i + ")").attr("clicId");
                                // console.log(this.onoff)
                            });
                            // 设置删除按钮属性
                            $('table').find('.sp2').each(function (i, v) {
                                this.clicId = $(".sp2:eq(" + i + ")").attr("clicId");
                                // console.log(this.clicId);
                            });
                        } else {
                            alert('没有数据了');
                        }
                    },
                    error: function (xhr, errorInfo) {
                        console.log('降序排序功能ajax请求失败');
                    }
                });
                $("#down").css('background', "url('img/下绿三角.png') center center no-repeat");
                $("#down").css('background-size', "100%");
                $("#up").css('background', "url('img/上灰三角.png') center center no-repeat");
                $("#up").css('background-size', "100%");
            });
            // 点击上三角排序
            $("#up").click(function () {
                $.ajax({
                    url: remindBtn,
                    type: 'get',
                    dataType: 'json',
                    data: {
                        // empId: '10001',
                        currentPage: num,
                        asc: '2',
                        rows: '10',
                        method: 'remindAll',
                    },
                    success: function (data) {
                        console.log(data);
                        if (data.code == 100) {
                            // 清空table数据
                            $(".trm").remove();
                            // 添加数据
                            for (var i = 0; i < data.result.list.length; i++) {
                                // 创建tr添加到table中
                                var trM = $('<tr>').appendTo('tbody');
                                $(trM).prop("class", "trm");
                                //创建td添加到tr中
                                $('<td>').html(i + 1).appendTo(trM);
                                $('<td>').html(data.result.list[i].empName).appendTo(trM);
                                if (data.result.list[i].moduleId == 1) {
                                    data.result.list[i].moduleId = '院校管理';
                                } else {
                                    data.result.list[i].moduleId = '学生管理';
                                }
                                $('<td>').html(data.result.list[i].moduleId).appendTo(trM);
                                if (data.result.list[i].remindTypeId == 1) {
                                    data.result.list[i].remindTypeId = '待跟进量提醒';
                                } else if (data.result.list[i].remindTypeId == 2) {
                                    data.result.list[i].remindTypeId = '转公共量提醒';
                                } else {
                                    data.result.list[i].remindTypeId = '接收量提醒';
                                }
                                $('<td>').html(data.result.list[i].remindTypeId).appendTo(trM);
                                $('<td>').html(data.result.list[i].remindContent).appendTo(trM);
                                var oremindTime = parseInt(data.result.list[i].remindTime);
                                var newData = new Date(oremindTime);
                                var iYear = newData.getFullYear();
                                var iMonth = newData.getMonth();
                                var iDay = newData.getDate();
                                var iHour = newData.getHours();
                                var iMinutes = newData.getMinutes();
                                var iSecond = newData.getMilliseconds();
                                var iTime = iYear + '-' + iMonth + '-' + iDay + ' ' + iHour + ':' + iMinutes + ':' + iSecond;
                                $('<td>').html(iTime).appendTo(trM);
                                $("<td><span class='sp1' onoff = " + data.result.list[i].remindState + " clicId = " + data.result.list[i].remindId + "><span></span></span><span class='sp2' clicId = " + data.result.list[i].remindId + "></span></td>").appendTo(trM);
                                // 设置开关
                                // console.log($(".sp1:eq(" + i + ")").attr('onoff'));
                                // console.log($(".sp1:eq(" + i + ")").attr('clicId'));
                                if ($(".sp1:eq(" + i + ")").attr('onoff') == 1) {
                                    $(".sp1:eq(" + i + ")").css('background', '#13ce66');
                                    $(".sp1:eq(" + i + ")").children('span').animate({
                                        left: '20px'
                                    }, 200);
                                } else {
                                    $(".sp1:eq(" + i + ")").css('background', '#ff4949');
                                    $(".sp1:eq(" + i + ")").children('span').animate({
                                        left: '0px'
                                    }, 200);
                                }
                            };
                            //设置开关属性 
                            $('table').find('.sp1').each(function (i, v) {
                                this.onoff = $(".sp1:eq(" + i + ")").attr("onoff");
                                this.clicId = $(".sp1:eq(" + i + ")").attr("clicId");
                                // console.log(this.onoff)
                            });
                            // 设置删除按钮属性
                            $('table').find('.sp2').each(function (i, v) {
                                this.clicId = $(".sp2:eq(" + i + ")").attr("clicId");
                                // console.log(this.clicId);
                            });
                        } else {
                            alert('没有数据了');
                        }
                    },
                    error: function (xhr, errorInfo) {
                        console.log('升序排序功能ajax请求失败');
                    }
                });
                $("#up").css('background', "url('img/上绿三角.png') center center no-repeat");
                $("#up").css('background-size', "100%");
                $("#down").css('background', "url('img/下灰三角.png') center center no-repeat");
                $("#down").css('background-size', "100%");
            });
        }
    });
    // 设置添加提醒按钮
    var num = 1;
    // 请求提醒人姓名
    $.ajax({
        url: remindBtn,
        type: 'get',
        dataType: 'json',
        data: {
            empId: '10001',
            method: 'remindEmp',
        },
        success: function (data) {
            console.log(data);
            for (var i = 0; i < data.result.length; i++) {
                $('<option value=' + data.result[i].empid + '>' + data.result[i].empName + '</option>').appendTo($('#slc01'));
            };
            // 设置下拉框
            $(".select01").M_select();
            $(".select01").M_select({
                "ico": "3",// ico的值可以为1-5 有五个样式的下拉箭头，如果想自己定义箭头样式，可以使用img，img2 传参
                // 手动添加下拉框箭头图片（以html页面为起始位置写路径）
                // "Img":"./js/M_select/up4.png",
                // "Img2":"./js/M_select/down1.png",
                "Title": "--下拉款的标题--",//定义为选择前的下拉框显示文档
                "radius": "10px",//定义圆角属性
                "inputName": "selected_value",//这里的inputName可以定义隐藏的input的name，通过name获取它的value的值（value的值为选中的下拉的value值，默认值为sel_v）          
                "selected": "02",//选择select初始的选择状态，相当于selected，03为下拉框的value的值
                Succee: function () {
                    alert("选择下拉之后的弹窗");
                }//选择选项之后的回调函数
            });
        },
        error: function (xhr, errorInfo) {
            console.log('提醒人姓名ajax请求失败');
        }
    });
    // 点击添加提醒按钮后ajax请求
    $("#tixi").click(function () {
        console.log($("#slc02").val());
        console.log($("#slc01").val());
        console.log($("#slc03").val());
        console.log($("#warnmain").val());
        console.log($("#test1").val() + "" + $("#test2").val());
        // ajax请求
        $.ajax({
            url: remindBtn,
            type: 'get',
            dataType: 'json',
            data: {
                method: 'remindAdd',
                moduleId: $("#slc02").val(),
                empId: $("#slc01").val(),
                remindTypeId: $("#slc03").val(),
                remindContent: $("#warnmain").val(),
                remindTime: $("#test1").val() + " " + $("#test2").val(),
            },
            success: function (data) {
                if (data.code == 100) {
                    console.log(data);
                    num++;
                    var trM = $('<tr>').appendTo('tbody');
                    //创建td添加到tr中
                    $('<td>').html(num).appendTo(trM);
                    $('<td>').html($("#slc01").val()).appendTo(trM);
                    $('<td>').html($("#slc02").val()).appendTo(trM);
                    $('<td>').html($("#slc03").val()).appendTo(trM);
                    $('<td>').html($("#warnmain").val()).appendTo(trM);
                    $('<td>').html($("#test1").val() + " &nbsp;" + $("#test2").val()).appendTo(trM);
                    $("<td><span class='sp1'><span></span></span><span class='sp2'></span></td>").appendTo(trM);
                    location.reload();
                } else {
                    alert('失败了');
                }
            },
            error: function (xhr, errorInfo) {
                console.log('提醒按钮ajax请求失败');
            }
        });
    });
    // ajax请求表格数据
    $.ajax({
        url: tabUrl,
        type: 'get',
        dataType: 'json',
        data: {
            empId: '10001',
            currentPage: 1,
            rows: '10',
            method: 'remindAll',
            asc: '1',
        },
        success: function (data) {
            if (data.code == 100) {
                allPage = data.result.totalPage;

                for (var i = 0; i < data.result.list.length; i++) {
                    // 创建tr添加到table中
                    var trM = $('<tr>').appendTo('tbody');
                    $(trM).prop("class", "trm");
                    //创建td添加到tr中
                    $('<td>').html(i + 1).appendTo(trM);
                    $('<td>').html(data.result.list[i].empName).appendTo(trM);
                    if (data.result.list[i].moduleId == 1) {
                        data.result.list[i].moduleId = '院校管理';
                    } else {
                        data.result.list[i].moduleId = '学生管理';
                    }
                    $('<td>').html(data.result.list[i].moduleId).appendTo(trM);
                    if (data.result.list[i].remindTypeId == 1) {
                        data.result.list[i].remindTypeId = '待跟进量提醒';
                    } else if (data.result.list[i].remindTypeId == 2) {
                        data.result.list[i].remindTypeId = '转公共量提醒';
                    } else {
                        data.result.list[i].remindTypeId = '接收量提醒';
                    }
                    $('<td>').html(data.result.list[i].remindTypeId).appendTo(trM);
                    $('<td>').html(data.result.list[i].remindContent).appendTo(trM);
                    var oremindTime = parseInt(data.result.list[i].remindTime);
                    var newData = new Date(oremindTime);
                    var iYear = newData.getFullYear();
                    var iMonth = newData.getMonth();
                    var iDay = newData.getDate();
                    var iHour = newData.getHours();
                    var iMinutes = newData.getMinutes();
                    var iSecond = newData.getMilliseconds();
                    var iTime = iYear + '-' + iMonth + '-' + iDay + ' ' + iHour + ':' + iMinutes + ':' + iSecond;
                    $('<td>').html(iTime).appendTo(trM);
                    $("<td><span class='sp1' onoff = " + data.result.list[i].remindState + " clicId = " + data.result.list[i].remindId + "><span></span></span><span class='sp2' clicId = " + data.result.list[i].remindId + "></span></td>").appendTo(trM);
                    // 设置开关
                    // console.log($(".sp1:eq(" + i + ")").attr('onoff'));
                    // console.log($(".sp1:eq(" + i + ")").attr('clicId'));
                    if ($(".sp1:eq(" + i + ")").attr('onoff') == 1) {
                        $(".sp1:eq(" + i + ")").css('background', '#13ce66');
                        $(".sp1:eq(" + i + ")").children('span').animate({
                            left: '20px'
                        }, 200);
                    } else {
                        $(".sp1:eq(" + i + ")").css('background', '#ff4949');
                        $(".sp1:eq(" + i + ")").children('span').animate({
                            left: '0px'
                        }, 200);
                    }
                };
                //设置开关属性 
                $('table').find('.sp1').each(function (i, v) {
                    this.onoff = $(".sp1:eq(" + i + ")").attr("onoff");
                    this.clicId = $(".sp1:eq(" + i + ")").attr("clicId");
                    // console.log(this.onoff)
                });
                // 设置删除按钮属性
                $('table').find('.sp2').each(function (i, v) {
                    this.clicId = $(".sp2:eq(" + i + ")").attr("clicId");
                    // console.log(this.clicId);
                });
            } else {
                alert('失败了');
            }
        },
        error: function (xhr, errorInfo) {
            console.log('表格数据ajax请求失败');
        }
    });

    // 点击开关按钮
    $('table').on("click", ".sp1", function () {
        // console.log(this.onoff);
        console.log(this.clicId);
        var onOff2;
        if (this.onoff == 1) {
            onOff2 = 2;
        } else {
            onOff2 = 1;
        }
        console.log(onOff2);
        // 开关ajax请求
        $.ajax({
            url: remindBtn,
            type: 'get',
            dataType: 'json',
            data: {
                empId: '10001',
                method: 'remindUpdate',
                remindId: this.clicId,
                remindState: onOff2,
            },
            success: function (data) {
                console.log(data);
                if (data.code == 100) {
                    // location.reload();
                }
            },
            error: function (xhr, errorInfo) {
                console.log('ajax请求失败');
            }
        });
        // alert("开关提醒");
        if (this.onoff == 1) {
            $(this).css('background', '#ff4949');
            $(this).children('span').animate({
                left: '0px'
            }, 200);
            this.onoff = 2;
        } else {
            $(this).css('background', '#13ce66');
            $(this).children('span').animate({
                left: '20px'
            }, 200);
            this.onoff = 1;
        };
    });
    // 设置删除按钮
    $('table').on('click', '.sp2', function () {
        alert('删除提醒');
        // 删除按钮ajax请求
        $.ajax({
            url: remindBtn,
            type: 'get',
            dataType: 'json',
            data: {
                empId: '10001',
                method: 'remindUpdate',
                remindId: this.clicId,
                remindState: 3,
            },
            success: function (data) {
                console.log(data);
                if (data.code == 100) {
                    $($(this).parent().parent()).remove();
                    location.reload();
                }
            },
            error: function (xhr, errorInfo) {
                console.log('ajax请求失败');
            }
        });
    });






</script>